//1.导入fs模块
const fs = require('fs');

// 2.stat 方法,status缩写
fs.stat('./1-座右铭.txt', (err, data) => {
  if (err) {
    console.log(err);
    return
  }
  console.log('success', data);
  // isFile
  console.log(data.isFile());
  // isDirectory
  console.log(data.isDirectory());
})